<?php
/**
 * Created by PhpStorm.
 * User: palidin
 * Date: 2019/3/1
 * Time: 9:23
 */

namespace App\Console\Commands;

use Fresh\Annotation\Console\Argument;
use Fresh\Annotation\Console\Configuration;
use Fresh\Annotation\Console\Option;
use Fresh\Console\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

/**
 * @Configuration(
 *     value="app:test",
 *     description="test create a command",
 *     arguments={
 *      @Argument(value="arg1",mode="required")
 *     },
 *     options={
 *      @Option(value="op1",mode="optional")
 *     }
 * )
 */
class DemoCommand extends Command
{
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $arg1 = $input->getArgument('arg1');
        $op1 = $input->getOption('op1');
        $output->write("hello world! arg1=$arg1,$op1=2");
    }

}